package com.yf.zzmusic.controller;

import com.yf.zzmusic.common.Result;
import com.yf.zzmusic.pojo.vo.sms.SmsVo;
import com.yf.zzmusic.service.ISmsService;
import com.yf.zzmusic.service.impl.SmsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/msg")
public class SmsMessageController {

  private ISmsService smsService=new SmsService();

  @GetMapping("/sendMsg/{phone}")
  public Result sendMessage(@PathVariable String phone) {
    if (phone==null){
      return Result.error("缺少必填参数");
    }else {
      SmsVo smsVo = smsService.sendSmsService(phone);
      if (smsVo != null) {
        return Result.success("发送短信成功", smsVo);
      } else {
        return Result.error("发送短信失败");
      }
    }
  }
}
